Create New Item
Item Type
File
Folder
Item Name
Search file in folder and subfolders...
Are you sure want to rename?
File Manager
/
reeft_gps_test
/
REEFTintegrationLog
/
saved
:
hub_stprpt.php
Advanced Search
Upload
New Item
Settings
Back
Back Up
Advanced Editor
Save
<?php //====================================================================================== // // Function: Stoptime - Report back to JDE // // Programmer: JKJ // Date : 2024-10-06 // // Copyright Reeft A/S (c) - 2024 //====================================================================================== // datatables parameters: // https://datatables.net/manual/server-side //====================================================================================== // General config //====================================================================================== include "config/config.php"; //====================================================================================== // Set language //====================================================================================== include "include/set_language.php"; //====================================================================================== // Get input //====================================================================================== if (isset($_REQUEST["WRKGRP"])) { $WRKGRP = $_REQUEST["WRKGRP"]; } else { $WRKGRP = ''; } if (isset($_REQUEST["WRKNO"])) { $WRKNO = $_REQUEST["WRKNO"]; } else { $WRKNO = ''; } if (isset($_REQUEST["WOSEQ"])) { $WOSEQ = $_REQUEST["WOSEQ"]; } else { $WOSEQ = ''; } if (isset($_REQUEST["RECQY"])) { $RECQY = $_REQUEST["RECQY"]; } else { $RECQY = ''; } if (isset($_REQUEST["SCRQY"])) { $SCRQY = $_REQUEST["SCRQY"]; } else { $SCRQY = ''; } if (isset($_REQUEST["STATUS"])) { $STATUS = $_REQUEST["STATUS"]; } else { $STATUS = ''; } if (isset($_REQUEST["mode"])) { $mode = $_REQUEST["mode"]; } else { $mode = ''; } if (isset($_REQUEST["OPERATORNUMBER"])) { $OPERATORNUMBER = $_REQUEST["OPERATORNUMBER"]; } else { $OPERATORNUMBER = ''; } if (isset($_REQUEST["SCRAPSREASONCODE"])) { $SCRAPSREASONCODE = $_REQUEST["SCRAPSREASONCODE"]; } else { $SCRAPSREASONCODE = ''; } if (isset($_REQUEST["FREENOTES"])) { $FREENOTES = $_REQUEST["FREENOTES"]; } else { $FREENOTES = ''; } //====================================================================================== // Get input //====================================================================================== $OPERATORNUMBER = urlencode( $OPERATORNUMBER ); $SCRAPSREASONCODE = urlencode( $SCRAPSREASONCODE ); $FREENOTES = urlencode( $FREENOTES ); //====================================================================================== // Get session variables //====================================================================================== include "include/getsession.php"; //====================================================================================== // Set language //====================================================================================== include "include/set_language.php"; //====================================================================================== // Connect to SQLite database in file //====================================================================================== $entries_found = 0; $returnCode = '99'; $returnMsg = 'No data found'; $currentDate = date('Y-m-d'); $currentTime = date('H:i:s'); //====================================================================================== // Set header //====================================================================================== header('Content-Type: application/json;charset=utf-8'); //====================================================================================== // Get time stamp //====================================================================================== $timeStamp = ''; if ( $timeStamp == '' ) { $now = DateTime::createFromFormat('U.u', number_format(microtime(true), 6, '.', '')); $timeStamp = $now->format("Y-m-d H:i:s"); } $data = array( "timestamp" => $timeStamp, "WRKGRP" => $WRKGRP, "WRKNO" => $WRKNO, "WOSEQ" => $WOSEQ, "RECQY" => $RECQY, "SCRQY" => $SCRQY, "OPERATORNUMBER" => $OPERATORNUMBER, "SCRAPSREASONCODE" => $SCRAPSREASONCODE, "FREENOTES" => $FREENOTES, "STATUS" => $STATUS ); //====================================================================================== // Make call to API somewhere //====================================================================================== $jsonData = json_encode($data); //header('Content-Type: application/json'); $json_pretty = json_encode(json_decode($jsonData), JSON_PRETTY_PRINT); // echo $json_pretty; // echo "<br>"; // echo $url; $headers = array( "Content-type: Content-Type:application/json", "User-Agent: DATA-HUB 1.0", "APIKEY: $DFT_API_KEY" ); $parms = '?' . 'WRKGRP=' . $WRKGRP . '&WRKNO=' . $WRKNO . '&WOSEQ=' . $WOSEQ . '&RECQY=' . $RECQY . '&SCRQY=' . $SCRQY . '&OPERATORNUMBER=' . $OPERATORNUMBER . '&SCRAPSREASONCODE=' . $SCRAPSREASONCODE . '&FREENOTES=' . $FREENOTES . '&STATUS=' . $STATUS ; // Set URL $url = $DFT_WEBSERVICE_URL_DATAHUB . '/' . 'HUB_STPRPT'; // Add parms $url = $url . $parms; // echo $url; // Create a new cURL resource $ch = curl_init($url); // Attach encoded JSON string to the POST fields curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonData); // Set the content type to application/json //curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json')); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers ); // Return response instead of outputting curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, false); //curl_setopt( $ch, CURLOPT_CUSTOMREQUEST, 'POST' ); curl_setopt($ch, CURLOPT_HEADER, false); // we do not need headers curl_setopt($ch, CURLOPT_NOBODY, false); // we don't need body // Execute the GET request $result = curl_exec($ch); $ary = curl_getinfo($ch); // Close cURL resource curl_close($ch); $data = json_decode($result, true); $returnResult = []; $returnResult["header"] = $data['header']; echo json_encode($returnResult); ?>